// API进行统一管理
import requests from "./request"

//引入mock模拟数据
import mockRequest from './mockAjax'

//三级联动接口
export const reqCategoryList = () => requests({ url: '/product/getBaseCategoryList', method: 'get' })

//轮播图
export const reqGetBannerList = () => mockRequest.get('/banner')

//家电
export const reqGetFloorList = () => mockRequest.get('/floor')

//获取search模块数据
//当前这个/api/list接口（获取搜索模块的数据），给服务器传递一个默认参数（至少是个空对象）
export const reqGetSearchInfo = (params) => requests({ url: '/list', method: 'post', data: params })

//获取产品详细信息的接口 url:/api/item/{skuId}  get请求
export const reqGoodsInfo = (skuId) => requests({ url: `/item/${skuId}`, methods: 'get' })

//将产品添加到购物车中（获取更新某一个产品的个数）
//api/cart/addToCart/{skuId}/{skuNum} POST
export const reqAddOrUpdateShopCart = (skuId, skuNum) => requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'post' })

//获取购物车列表
//api/cart/cartList   get请求
export const reqCartList = () => requests({ url: '/cart/cartList', method: 'get' })

//删除购物车产品接口
//api/cart/deleteCart/{skuId}  delete请求
export const reqDeleteCartById = (skuId) => requests({ url: `/cart/deleteCart/${skuId}`, method: 'delete' })

//修改商品的选中状态
//api/cart/checkCart/{skuId}/{isChecked}  get
export const reqUpdateCheckedById = (skuId, isChecked) => requests({ url: `/cart/checkCart/${skuId}/${isChecked}`, method: 'get' })

//获取验证码接口 
// /api/user/passport/sendCode/${phone}   get
export const reqGetCode = (phone) => requests({ url: `/user/passport/sendCode/${phone}`, method: 'get' })

//用户点击注册
// /api/user/passport/register post
export const reqUserRegister = (data) => requests({ url: '/user/passport/register', data, method: 'post' })

//登录
// /api/user/passport/login post
export const reqUserLogin = (data) => requests({ url: '/user/passport/login', data, method: 'post' })

//获取用户信息（带着token向服务器要用户信息）
// /api/user/passport/auth/getUserInfo   get
export const reqUserInfo = () => requests({ url: '/user/passport/auth/getUserInfo', methods: 'get' })

//退出登录
// /api/user/passport/logout get
export const reqLogout = () => requests({ url: '/user/passport/logout', methods: 'get' })

//获取用户地址信息    必须是13700000000   111111 账号 密码 才有数据
// url: /api/user/userAddress/auth/findUserAddressList    get
export const reqAddressInfo = () => requests({ url: '/user/userAddress/auth/findUserAddressList', methods: 'get' })

//获取商品清单
// url: /api/order/auth/trade   get
export const reqOrderInfo = () => requests({ url: "/order/auth/trade", methods: 'get' })

//提交订单
// url： /api/order/auth/submitOrder?tradeNo={tradeNo}  post
export const reqSubmitOrder = (tradeNo, data) => requests({ url: `/order/auth/submitOrder?tradeNo=${tradeNo}`, data, method: 'post' })

//获取支付信息
// url：/api/payment/weixin/createNative/{orderId}  get
export const reqPayInfo = (orderId) => requests({ url: `/payment/weixin/createNative/${orderId}`, method: 'get' })

//获取支付订单状态
// url：/api/payment/weixin/queryPayStatus/{orderId}  get
export const reqPayStatus = (orderId) => requests({ url: `/payment/weixin/queryPayStatus/{orderId}`, method: 'get' })

//获取个人中心的数据
// uri: /api/order/auth/{page}/{limit}   get
export const reqMyOrderList = (page, limit) => requests({ url: `/order/auth/${page}/${limit}`, method: 'get' })